﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>MediaPortal WebServices--VLC Player</title>
    <script language=javascript>
      function getQuerystring(key, default_)
      {
        if (default_==null) default_=""; 
        key = key.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
        var regex = new RegExp("[\\?&]"+key+"=([^&#]*)");
        var qs = regex.exec(window.location.href);
        if(qs == null)
          return default_;
        else
          return qs[1];
      }

      function getVlcPlayer(vlc_id)
      {
 	if (document.all) vlc_id += '_ie';
	return document.getElementById(vlc_id);
      }

      function Init()
      {
        document.getElementById('medianame').innerHTML=getQuerystring("media","");
        var qUrl=getQuerystring("url","");
        url="Streamer.aspx?"+qUrl.replace(/,/g,"&");

        var vlc = getVlcPlayer('vlcplayer');
        vlc.playlist.add(url);
        vlc.playlist.play();
    }

    function EnableDeinterlace(type) {
        var vlc = getVlcPlayer('vlcplayer');
        if (typeof (vlc.video.deinterlace) !== "undefined") {
            vlc.video.deinterlace.enable(type);
        } else {
            alert("Your VLC version is too old to support deinterlacing in the browser. Update to at least version 1.1.0");
        }
    }
</script>
</head>
<body onload="Init()">
  <b>Media:</b> <span id="medianame"></span><br /><br />
  <input type="button" value="play" onclick="getVlcPlayer('vlcplayer').playlist.play();" />&nbsp; 
  <input type="button" value="pause" onclick="getVlcPlayer('vlcplayer').playlist.togglePause();" />&nbsp; 
  <input type="button" value="stop" onclick="getVlcPlayer('vlcplayer').playlist.stop();" />&nbsp; 
  <input type="button" value="switch fullscreen" onclick="getVlcPlayer('vlcplayer').video.fullscreen=true;" /> &nbsp;
  <input type="button" value="enable deinterlacing" onclick="EnableDeinterlace('linear');" />&nbsp;
  <hr style="border: solid 1px black" />


<object id="vlcplayer_ie" classid="clsid:9BE31822-FDAD-461B-AD51-BE1D1C159921" width="400" height="300" events="True">
        <param name="ShowDisplay" value="false" ></param>
        <param name="AutoLoop" value="no"></param>
        <param name="AutoPlay" value="no"></param>
  <embed id="vlcplayer" type="application/x-vlc-plugin" pluginspage="http://www.videolan.org" version="VideoLAN.VLCPlugin.2"
   autoplay="no" loop="no" width="400" height="300" />
</object>

</body>
</html>
